<?php

/**
 * Description of TestJs.
 *
 * @author Ian Clarence <ian.clarence@gmail.com>
 */
final class TestJs extends ViewResources {
    
    /**
     * The constructor. 
     */    
    public function __construct() {
        parent::__construct();
    }
    
    /**
     * Loading the CSS rules, and returning as an array.
     *  
     * @param array $viewFields
     * @return array
     */
    protected function resources($viewFields = array()) {
                
        /**
        * Turns the background yellow when hovering over a link.
        */
        $js = new ViewCodeSnippet('
            :link.hover(
                function() {
                    :background.css("background-color","#CCFFFF");                            
                },
                function() {
                    :background.css("background-color","#FFFFFF");
                }
            );
        ');
        $link = new ViewJqueryObject(ViewSelector::selectorInit('a'));
        $background = new ViewJqueryObject(ViewSelector::selectorInit('div', 'container'));
        $js->bindTextString('link', $link->view());
        $js->bindTextString('background', $background->view());
        
        $this->fields[] = $js;
        
        return $this->fields;
        
    }
    
}